package com.cn.servelt;

import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "MyServlet", value = "/MyServlet")
public class MyServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        request.setAttribute("stuname","hyz");
//        request.setAttribute("stuid","350");
//        request.getRequestDispatcher("/myjsp.jsp").forward(request,response);
//        String num1 = (String) request.getAttribute("num1");
//        String num2 = (String) request.getAttribute("num2");
//        String num3 = (String) request.getAttribute("num3");
        String num1 = request.getParameter("num1");
        String num2 = request.getParameter("num2");
        String num3 = request.getParameter("num3");
        PrintWriter out = response.getWriter();
        out.println("num1:"+num1);
        out.println("num2:"+num2);
        out.println("num3:"+num3);

    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}